package com.threeox.commonlibrary.ui.view.impl;

import android.content.Context;
import android.view.View;
import android.widget.AdapterView;

import com.threeox.commonlibrary.adapter.base.IAdapter;
import com.threeox.commonlibrary.entity.engine.model.listmodel.ListModelMsg;
import com.threeox.commonlibrary.entity.engine.request.base.BaseRequestMsg;
import com.threeox.commonlibrary.ui.view.engineview.listmodel.ListModelBaseView;
import com.threeox.commonlibrary.ui.view.impl.base.CommonModelExtend;
import com.threeox.commonlibrary.ui.view.inter.engine.listmodel.IListModelExtend;
import com.threeox.commonlibrary.ui.view.inter.pullrefresh.IPullToRefLayout;

import java.util.List;

/**
 *
 * @ClassName: AbstractListModelExtend
 *
 * @Description: TODO()
 *
 * @author 赵屈犇
 *
 * @date 创建时间: 2017/6/30 16:24
 *
 * @version 1.0
 *
 */
public abstract class AbstractListModelExtend<T> extends CommonModelExtend implements IListModelExtend<T> {

    protected List<T> mDatas;
    protected Context mContext;
    protected IAdapter mAdapter;
    protected ListModelMsg mListModelMessage;
    protected IPullToRefLayout mPullToRefLayout;
    protected ListModelBaseView mListModelBaseView;

    @Override
    public boolean init(Context context, ListModelBaseView listModelBaseView) {
        this.mContext = context;
        this.mListModelBaseView = listModelBaseView;
        this.mDatas = listModelBaseView.getDatas();
        this.mAdapter = mListModelBaseView.getAdapter();
        this.mPullToRefLayout = listModelBaseView.getPullToRefLayout();
        this.mListModelMessage = mListModelBaseView.getListModelMessage();
        initBaseExtend(mListModelBaseView);
        initView();
        initData();
        setListener();
        return true;
    }

    @Override
    public boolean onDownPullRefresh() {
        return true;
    }

    @Override
    public boolean onLoadingMore() {
        return true;
    }

    @Override
    public boolean exec(boolean isFirst, BaseRequestMsg requestMsg) {
        return true;
    }

    @Override
    public List onParseData(T datas) {
        return null;
    }

    @Override
    public boolean onBeforeParseData(List<T> datas) {
        return true;
    }

    @Override
    public void onAfterParseData(boolean isFirst, List<T> datas) {

    }

    @Override
    public Object interceptGetItemData(int position) {
        return null;
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long arg3, T data) {

    }

    @Override
    public Boolean onItemLongClick(AdapterView<?> arg0, View arg1, int position, long arg3, T data) {
        return null;
    }
}
